package digital.store.tutorial.springmvc.model;

import java.util.Collection;
import java.util.Date;
import java.util.Map;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;


import javax.persistence.*;

import digital.store.tutorial.springmvc.model.Product;






@Entity
public class Order {
	@Id 
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	
	
	public Long getId() {
		return id;
	}	

	public void setId(Long id) {
		this.id = id;
	}
	
	private int total;
	
	private String status;
		
	private Date dateAdd;
	
	private Date dateModified;
	
	@ManyToMany(fetch = FetchType.LAZY , mappedBy ="orders")
	private Map<Long, Product> products;
	
	public Map<Long, Product> getProducts() {
		return products;
	}

	public void setProducts(Map<Long, Product> products) {
		this.products = products;
	}

	@ManyToOne (fetch = FetchType.LAZY)
	private Customer customer;


	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Date getDateAdd() {
		return dateAdd;
	}

	public void setDateAdd(Date dateAdd) {
		this.dateAdd = dateAdd;
	}

	public Date getDateModified() {
		return dateModified;
	}

	public void setDateModified(Date dateModified) {
		this.dateModified = dateModified;
	}
	
}
